package calcPatterns;

public class Math implements IMath, IMathAdvanced {

    private static Math instance;

    private Math() {
        System.out.println("Объект создан...");
    }

    public static Math getInstance() {
        if (instance == null) {
            instance = new Math();
        }
        return instance;
    }

    @Override
    public double add(double num1, double num2) {
        return num1 + num2;
    }

    @Override
    public double sub(double num1, double num2) {
        return num1 - num2;
    }

    @Override
    public double mul(double num1, double num2) {
        return num1 * num2;
    }

    @Override
    public double div(double num1, double num2) {
        return num1 / num2;
    }

    @Override
    public double exp(int num) {
      return java.lang.Math.exp(num);
    }

    @Override
    public int decimalToOctal(int num) {
        return Integer.decode(Integer.toOctalString(num));
    }
}
